﻿Imports System.Collections.Generic
Imports System.Linq
Imports System.Data
Imports System.Text
Imports System.Windows.Forms
Imports DevComponents.DotNetBar.Controls
Imports DevComponents.Editors.DateTimeAdv
Imports DoAnQuanLyBanHang1065043_1065007.DoAnQuanLyBanHang.DTO
Imports DoAnQuanLyBanHang1065043_1065007.DoAnQuanLyBanHang.General

Namespace DoAnQuanLyBanHang.DAO
    Public Class LoaiGiaoDichCtrl
        Private m_LoaiGiaoDichData As New LoaiGiaoDichData()

        Public Sub HienThiComboBox(cbx As ComboBox)
            Dim m_DT As DataTable = m_LoaiGiaoDichData.LayLoaiGiaoDich()
            cbx.DataSource = m_DT
            cbx.DisplayMember = "TenLoaiGiaoDich"
            cbx.ValueMember = "MaLoaiGiaoDich"
        End Sub

#Region "Hien thi ComboBox trong DataGridView"
        Public Sub HienThiDataGridViewComboBoxColumn(cmbColumn As DataGridViewComboBoxColumn)
            cmbColumn.DataSource = m_LoaiGiaoDichData.LayLoaiGiaoDich()
            cmbColumn.DisplayMember = "TenLoaiGiaoDich"
            cmbColumn.ValueMember = "MaLoaiGiaoDich"
            cmbColumn.DataPropertyName = "MaLoaiGiaoDich"
            cmbColumn.HeaderText = "Loại Giao Dịch"
        End Sub
#End Region

#Region "hien thi"
        Public Sub HienThi(Dgv As DataGridView, bvn As BindingNavigator)
            Dim bs As New BindingSource()

            bs.DataSource = m_LoaiGiaoDichData.LayLoaiGiaoDich()
            bvn.BindingSource = bs
            Dgv.DataSource = bs
        End Sub

        Public Sub HienThi(dGV As DataGridViewX, bN As BindingNavigator, txtMaLoaiGiaoDich As TextBoxX, txtTenLoaiGiaoDich As TextBoxX)
            Dim bS As New BindingSource()
            bS.DataSource = m_LoaiGiaoDichData.LayLoaiGiaoDich()

            txtMaLoaiGiaoDich.DataBindings.Clear()
            txtMaLoaiGiaoDich.DataBindings.Add("Text", bS, "MaLoaiGiaoDich")

            txtTenLoaiGiaoDich.DataBindings.Clear()
            txtTenLoaiGiaoDich.DataBindings.Add("Text", bS, "TenLoaiGiaoDich")

            bN.BindingSource = bS
            dGV.DataSource = bS
        End Sub
#End Region

#Region "Them moi"
        Public Function ThemDongMoi() As DataRow
            Return m_LoaiGiaoDichData.ThemDongMoi()
        End Function
        Public Sub ThemMoi(m_Row As DataRow)
            m_LoaiGiaoDichData.ThemLoaiGiaoDich(m_Row)
        End Sub
#End Region

#Region "Luu"
        Public Function LuuLoaiGiaoDich() As Boolean
            Return m_LoaiGiaoDichData.LuuLoaiGiaoDich()
        End Function
#End Region
    End Class
End Namespace
